<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
        <ui:composition template="commonLayout.xhtml">
            <ui:define name="content">
                <div class="main center">
                    <section class="part clearfix">
                        <header class="title clearfix">
                        </header>
                        <h:body>
                            <script type="text/javascript">
                            function validateForm(){
                                if (window.clicked == "#{msg.next}")
                                    return true;
            
                                if (isNaN(document.getElementById("myform:years").value) || document.getElementById("myform:years").value == "" || document.getElementById("myform:years").value == "0.0" || document.getElementById("myform:years").value == "0" || document.getElementById("myform:years").value == "0."){
                                    alert("#{msg.workexpmsg}");
                                    return false;
                                }
                                else{
                                    return true;
                                }
                            }
                            </script>
                            <h:form id="myform" onsubmit="return validateForm();">
                                <h3><h:outputText value="#{msg.workexp}" /></h3>
                                <p>
                                    <h:outputText value="#{msg.areaexp}" /><br/>
                                    <h:selectOneMenu id="area" value="#{applicantmanager.areaofexp}">
                                        <f:selectItems value="#{applicantmanager.competence}" />
                                    </h:selectOneMenu>
                                    <br/><br/>
                                    <h:outputText value="#{msg.yearexp}" /><br/>
                                    <h:inputText id="years" value="#{applicantmanager.yearsofexp}">
                                        <f:validator validatorId="checkexperience" />
                                    </h:inputText>
                                </p>
                                <p>
                                    <h:commandButton type="submit" id="next1" value="#{msg.add}" action="#{applicantmanager.addAOE}"/>
                                </p>
                                <p>
                                    <h:outputText value="#{applicantmanager.areaofexpstring}" escape="false" />
                                </p>
                            </h:form>
                            <h:form>
                                <h:commandButton value="#{msg.next}" action="#{applicantmanager.nextPage2}"/><br /><br />
                                <h:commandButton value="#{msg.cancel}" action="#{applicantmanager.cancel}" />
                            </h:form>
                        </h:body>
                    </section>
                </div>
            </ui:define>
        </ui:composition>
</html>
